var i;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var BundleConfig = require("AA_BundleConfig");
var ResKeeper = require("AA_ResKeeper");
var PlayerDataManager = require("AA_PlayerDataManager");
var Excel = require("AA_Excel");
var _decorator = cc._decorator;
var _ccclass = _decorator.ccclass;
var _property = _decorator.property;

var _def_UI_TuJianItem = function (e) {
  function _creator() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.shuiguo1 = null;
    t.shuiguo2 = null;
    t.shuiguo3 = null;
    t.putongmater = null;
    t.zhihuimater = null;
    t.lockNode = null;
    t.unlockNode = null;
    t.paizi1 = 0;
    t.paizi2 = 0;
    t.paizi3 = 0;
    t.paizi1y = 0;
    t.paizi2y = 0;
    t.paizi3y = 0;
    t.jiesuostate = {};
    return t;
  }
  __extends(_creator, e);
  _creator.prototype.initData = function (e) {
    var t = e.id - 1e3;
    var o = e.jinjieShuiGuoId - 1e3;
    this.initShuiGuo1(t, this.shuiguo1, 1);
    this.initShuiGuo1(o, this.shuiguo2, 2);
    this.initShuiGuo3(t, o, this.shuiguo3);
    this.paizi1 = this.shuiguo1.getChildByName("paizi").x;
    this.paizi2 = this.shuiguo2.getChildByName("paizi").x;
    this.paizi3 = this.shuiguo3.getChildByName("paizi").x;
    this.paizi1y = this.shuiguo1.getChildByName("paizi").y;
    this.paizi2y = this.shuiguo2.getChildByName("paizi").y;
    this.paizi3y = this.shuiguo3.getChildByName("paizi").y;
  };
  _creator.prototype.initShuiGuo3 = function (e, t, o) {
    return __awaiter(this, undefined, undefined, function () {
      var t;
      var n;
      var i;
      var a;
      var r;
      return __generator(this, function (c) {
        switch (c.label) {
          case 0:
            t = o.children[0].getComponent(cc.Sprite);
            return [4, this._loadRes(BundleConfig.BundleNames.Common, "common/" + "res/player/player" + e + "_5", cc.SpriteFrame)];
          case 1:
            n = c.sent();
            t.spriteFrame = n;
            t.setMaterial(0, this.putongmater);
            i = o.getChildByName("paizi");
            a = this.paizi3;
            r = this.paizi3y;
            o.getChildByName("shuiguoname").getComponent(cc.Label).string = Excel.Excel.shuiguo(e + 1e3).newName;
            switch (e) {
              case 10:
                i.x = a - 20;
                t.node.height = 120;
                t.node.width = 50;
                break;
              case 4:
                i.x = a - 20;
                t.node.height = 120;
                t.node.width = 60;
                break;
              case 8:
                i.y = r - 50;
                t.node.height = 60;
                t.node.width = 120;
                break;
              case 11:
                i.x = a - 25;
                t.node.height = 120;
                t.node.width = 60;
                break;
              case 3:
                i.x = a - 25;
                t.node.height = 80;
                t.node.width = 80;
                break;
              default:
                t.node.height = 120;
                t.node.width = 120;
            }
            return [2];
        }
      });
    });
  };
  _creator.prototype.initShuiGuo1 = function (e, t, o) {
    return __awaiter(this, undefined, undefined, function () {
      var n;
      var i;
      var a;
      var r;
      var c;
      var l;
      var h;
      var f;
      var g;
      return __generator(this, function (s) {
        switch (s.label) {
          case 0:
            n = Excel.Excel.shuiguo(e + 1e3);
            i = t.children[1].getComponent(cc.Sprite);
            a = t.children[0].getComponent(cc.Label);
            if ((r = PlayerDataManager.PlayerDataMgr.GetEquipDataById(e + 1e3)) && r.isUnLock) {
              i.setMaterial(0, this.putongmater);
              c = n.jinJieLv;
              if (r.level >= c) {
                a.node.active = false;
                this.jiesuostate[e] = 3;
              } else {
                a.string = "外部等级" + c + "解锁";
                this.jiesuostate[e] = 2;
              }
            } else {
              this.jiesuostate[e] = 1;
              i.setMaterial(0, this.zhihuimater);
              a.string = "通过" + n.unLock + "章解锁";
            }
            return [4, this._loadRes(BundleConfig.BundleNames.Common, "common/" + "res/player/player" + e + "_4", cc.SpriteFrame)];
          case 1:
            l = s.sent();
            i.spriteFrame = l;
            h = t.getChildByName("paizi");
            f = 0;
            g = 0;
            if (1 == o) {
              f = this.paizi1;
              g = this.paizi1y;
            }
            if (2 == o) {
              f = this.paizi2;
              g = this.paizi2y;
            }
            switch (e) {
              case 10:
                h.x = f - 20;
                i.node.height = 120;
                i.node.width = 50;
                break;
              case 4:
                h.x = f - 20;
                i.node.height = 120;
                i.node.width = 60;
                break;
              case 8:
                h.y = g + 30;
                i.node.height = 60;
                i.node.width = 120;
                break;
              case 11:
                h.x = f - 25;
                i.node.height = 120;
                i.node.width = 60;
                break;
              case 3:
                h.x = f - 25;
                h.y = g + 25;
                i.node.height = 80;
                i.node.width = 80;
                break;
              case 12:
                h.x = f - 25;
                i.node.height = 120;
                i.node.width = 60;
                break;
              case 1:
                h.x = f - 25;
                i.node.height = 120;
                i.node.width = 80;
                break;
              default:
                i.node.height = 120;
                i.node.width = 120;
            }
            return [2];
        }
      });
    });
  };
  __decorate([_property(cc.Node)], _creator.prototype, "shuiguo1", undefined);
  __decorate([_property(cc.Node)], _creator.prototype, "shuiguo2", undefined);
  __decorate([_property(cc.Node)], _creator.prototype, "shuiguo3", undefined);
  __decorate([_property(cc.Material)], _creator.prototype, "putongmater", undefined);
  __decorate([_property(cc.Material)], _creator.prototype, "zhihuimater", undefined);
  __decorate([_property(cc.Node)], _creator.prototype, "lockNode", undefined);
  __decorate([_property(cc.Node)], _creator.prototype, "unlockNode", undefined);
  return __decorate([_ccclass], _creator);
}(ResKeeper.default);
exports.default = _def_UI_TuJianItem;